package greed.P1007;/*
 *   exercise
 *   greed.P1109.P1007
 *
 *   description:
 *   @data 2025/4/27     下午7:46
 *   @author 凉风
 */

import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int len = sc.nextInt();
        int num = sc.nextInt();

        int[] st = new int[num];
        int min = 0;
        int max = 0;
        for (int n = 0; n < num; ++n) {
            st[n] = sc.nextInt();
            int com = Math.min(st[n], len - st[n] + 1);
            min = Math.max(min, com);
            com = Math.max(st[n], len - st[n] + 1);
            max = Math.max(max, com);
        }
        System.out.println(min + " " + max);
    }

}

